package com.qf.shop.filesystem.config;

import com.qiniu.storage.UploadManager;
import com.qiniu.util.Auth;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QiniuConfig {

    @Value("${qiniu.ak}")
    private String ak;

    @Value("${qiniu.sk}")
    private String sk;


    // 上传对象
    @Bean
    public UploadManager uploadManager() {
        UploadManager uploadManager = new UploadManager(new com.qiniu.storage.Configuration());
        return uploadManager;
    }

    // 认证对象
    @Bean
    public Auth qiqiuAuth() {

        return Auth.create(ak, sk);
    }

}
